#!/usr/bin/env bash

#get this script real directory
SOURCE="$0"
while [ -h "$SOURCE"  ]; do # resolve $SOURCE until the file is no longer a symlink
    this_script_dir="$( cd -P "$( dirname "$SOURCE"  )" && pwd  )"
    SOURCE="$(readlink "$SOURCE")"
    # if $SOURCE was a relative symlink, 
    #we need to resolve it relative to the path 
    #where the symlink file was located
    [[ $SOURCE != /*  ]] && SOURCE="$this_script_dir/$SOURCE"
done
this_script_dir="$( cd -P "$( dirname "$SOURCE"  )" && pwd  )"

log_level=${log_level:=info}
assist_dir=${assist_dir:=$this_script_dir/assist}
source $assist_dir/global.sh

if  ! git branch > /dev/null 2>&1 ; then
    vloge "current dir does not contain .git, cur_dir is:$(pwd)"
    exit 1
fi


vlogi "current dir: $(pwd)"
vlogi "execute cmd: git add . ; git commit -m'push by agit.sh'; git push"

echo "--------------------------------------------------"
git branch -vv | cat
git remote -v  | cat
echo "--------------------------------------------------"

git add . ; git commit -m'push by agit.sh'; git push
